<script>
updateList=function()
{
	SimpleCallObject({'module': "Milestone.ShowMilestones"},"milestones");
}
CreateMilestone=function()
	{
		var newProject=new Object();
		newProject.module="Milestone.CreateMilestone";
		newProject.Name=$("name").getValue();
		newProject.Start=$("start").getValue();
		newProject.End=$("end").getValue();
		
		new Ajax.Request('Model.php', {
			method: 'post',
			parameters: newProject,
			onSuccess: function(transport){
				var JSONtext = transport.responseText;
				var JSONobject = JSON.parse(JSONtext);
				if(JSONobject['result']==1)
						updateList();
				else
					$("warning").update(JSONobject['error']);
			},
			onFailure: function(){
				$("warning").update("Could not connect to server");
			}
		})
	

	} 

</script>
<h1>Create Milestone</h1>
	<form>
		<table>
			<tr>
				<td>Name:</td>
				<td><input type="text" id="name" type="text"></td>
			</tr>
			
			<tr>
				<td>Start:</td>
				<td><input type="text" id="start" readonly onClick="displayCalendar(this,'dd.mm.yyyy',this);" type="text"></td>
			</tr>
			<tr>
				<td>End:</td>
				<td><input type="text" id="end" readonly onClick="displayCalendar(this,'dd.mm.yyyy',this);" type="text"></td>
			</tr>
			<tr>
				<td colspan="2"><input type="button" onclick="CreateMilestone()" value="Create Milestone"></td>
				
			</tr>
			
		</table>	
	</form>
<h1>Show Milestones</h1>
<div id="milestones"><script>updateList();</script></div>
